package com.system.honour.service.impl;

import com.system.honour.common.ResultDTO;
import com.system.honour.entity.SysRoleExample;
import com.system.honour.entity.SysRoleUser;
import com.system.honour.exception.CustomizeErrorCode;
import com.system.honour.mapper.SysRoleUserMapper;
import com.system.honour.service.RoleUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Service
@Transactional
public class RoleUserServiceImpl implements RoleUserService {

    @Autowired
    private SysRoleUserMapper roleUserMapper;

    @Override
    public ResultDTO getRoleUserByUserId(Integer userId) {
        if (userId==null){
            return ResultDTO.errorOf(CustomizeErrorCode.INCORRECT_INFORMATION);
        }
        List<SysRoleUser> roleUserList = roleUserMapper.getByUserId(userId);
        return ResultDTO.okOf(roleUserList);
    }
}
